
import sqlite3
'''
完善学生信息

'''
#姓名
def students_name(stu_id,name):
    import sqlite3
    # 创建数据库连接
    conn = sqlite3.connect('tables.db')

    # 创建游标
    cursor = conn.cursor()

    cursor.execute("UPDATE students SET name = ? WHERE student_id = ?", (name, stu_id))
    conn.commit()


    # 提交更改
    conn.commit()

    # 关闭游标和连接
    cursor.close()
    conn.close()
#用户名
def students_username(stu_id,username):
    import sqlite3
    # 创建数据库连接
    conn = sqlite3.connect('tables.db')

    # 创建游标
    cursor = conn.cursor()

    cursor.execute("UPDATE students SET username = ? WHERE student_id = ?", (username, stu_id))
    conn.commit()


    # 提交更改
    conn.commit()

    # 关闭游标和连接
    cursor.close()
    conn.close()
#性别
def students_gender(stu_id,gender):
    import sqlite3
    # 创建数据库连接
    conn = sqlite3.connect('tables.db')

    # 创建游标
    cursor = conn.cursor()

    cursor.execute("UPDATE students SET gender = ? WHERE student_id = ?", (gender, stu_id))
    conn.commit()



    # 提交更改
    conn.commit()

    # 关闭游标和连接
    cursor.close()
    conn.close()
#密保
def students_security_question(stu_id,security_question):
    import sqlite3
    # 创建数据库连接
    conn = sqlite3.connect('tables.db')

    # 创建游标
    cursor = conn.cursor()

    cursor.execute("UPDATE students SET security_question = ? WHERE student_id = ?", (security_question, stu_id))
    conn.commit()


    # 提交更改
    conn.commit()

    # 关闭游标和连接
    cursor.close()
    conn.close()


'''
完善老师信息

'''
#姓名
def teacher_name(job_id,name):
    import sqlite3
    # 创建数据库连接
    conn = sqlite3.connect('tables.db')

    # 创建游标
    cursor = conn.cursor()

    cursor.execute("UPDATE teachers SET name = ? WHERE job_id = ?", (name, job_id))
    conn.commit()


    # 提交更改
    conn.commit()

    # 关闭游标和连接
    cursor.close()
    conn.close()
#用户名
def teacher_username(stu_id,username):
    import sqlite3
    # 创建数据库连接
    conn = sqlite3.connect('tables.db')

    # 创建游标
    cursor = conn.cursor()

    cursor.execute("UPDATE teachers SET username = ? WHERE job_id =  ?", (username, job_id))
    conn.commit()


    # 提交更改
    conn.commit()

    # 关闭游标和连接
    cursor.close()
    conn.close()

    # 性别
def teacher_gender(job_id, gender):
        import sqlite3
        # 创建数据库连接
        conn = sqlite3.connect('tables.db')

        # 创建游标
        cursor = conn.cursor()

        cursor.execute("UPDATE teachers SET gender = ? WHERE job_id = ?", (gender, job_id))
        conn.commit()

        # 提交更改
        conn.commit()

        # 关闭游标和连接
        cursor.close()
        conn.close()


# 密保
def teacher_security_question(job_id, security_question):
    import sqlite3
    # 创建数据库连接
    conn = sqlite3.connect('tables.db')

    # 创建游标
    cursor = conn.cursor()

    cursor.execute("UPDATE teachers SET security_question = ? WHERE job_id = ?", (security_question, job_id))
    conn.commit()

    # 提交更改
    conn.commit()

    # 关闭游标和连接
    cursor.close()
    conn.close()
